<#include '/admin/sonheader.html' >
<style>
.layui-form-pane .layui-form-label{
width:180px;
}
</style>
<div class="main">
    <!--表单区域  -->
	<form id="addForm" class="layui-form layui-form-pane" action="">
  		<div class="layui-form-item">
    		<label  style="width: 35%;" class="layui-form-label" >类型名称</label>
    		<div class="layui-input-block">
      			<input type="text" class="layui-input layui-form-danger"  id="goodsname" name="name" maxlength="20" lay-verify="required"  autocomplete="off" class="layui-input" style="width: 77%;">
    		</div>
  		</div>
  		
  		<div class="layui-form-item">
    		<label style="width: 35%;" class="layui-form-label">此类型下商品是否拥有属性</label>
    		<div class="layui-input-block">
      			<input type="radio" name="have_prop" value="0" title="否">
      			<input type="radio" name="have_prop" value="1" title="是" checked="checked">
    		</div>
  		</div>
  		
  		<div class="layui-form-item">
    		<label style="width: 35%;" class="layui-form-label">此类型下商品是否拥有参数</label>
    		<div class="layui-input-block">
      			<input type="radio" name="have_parm" value="0" title="否">
      			<input type="radio" name="have_parm" value="1" title="是" checked="checked">
    		</div>
  		</div>
  		
  		<div class="layui-form-item">
    		<label  style="width: 35%;" class="layui-form-label">此类型是否关联品牌</label>
    		<div class="layui-input-block">
      			<input type="radio" name="join_brand" value="0" title="否">
      			<input type="radio" name="join_brand" value="1" title="是" checked="checked">
    		</div>
  		</div>
  		
  		<div class="layui-form-item">
    		<label  style="width: 35%;" class="layui-form-label">此类型是否关联规格</label>
    		<div class="layui-input-block">
      			<input type="radio" name="join_spec" value="0" title="否">
      			<input type="radio" name="join_spec" value="1" title="是" checked="checked">
    		</div>
  		</div>
  		
  		<div class="layui-layer-btn layui-layer-btn-" style="padding:8px 12px;z-index:1000;position: fixed;left: 1px;width: 96%;height: 50px; background:rgba(230,230,230,0.8)"> 
  			<a class="layui-layer-btn0" type="submit" lay-submit="" lay-filter="savetype">保存</a>
  		</div>
  	</form>
</div>

<script>
var index = parent.layer.getFrameIndex(window.name);

layui.use(['form', 'layedit', 'laydate'], function(){
    var form = layui.form()
        ,layer = layui.layer
        ,layedit = layui.layedit
        ,laydate = layui.laydate;
    
    //监听提交
    form.on('submit(savetype)', function(data){
    	var options = {
   			url:ctx+"/shop/admin/type/checkname.do",
   			type:"post",
   			dataType:"json",
   			success:function(data){
   				if(data.result==1){	
   					parent.$.Loading.success("保存成功");
   					parent.layer.close(index); //再执行关闭        
   					parent.table.ajax.url(ctx+"/shop/admin/type/list-json.do").load();
   				}else{
   					parent.$.Loading.error(data.message);
   				}
   			}
   		};
   		$("#addForm").ajaxSubmit(options);
       return false;
    });
});
</script>


